﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace kongjian50
{
    [Designer(typeof(TongJi_EMS._TJ_Basic.TJ_BasicControlDesigner))]
    public partial class Shouche_10k_Up : TongJi_EMS._TJ_Basic.TJ_BasicControl
    {
        public Shouche_10k_Up()
        {
            InitializeComponent();
            this.NeedPoint = true;
        }
        //手车在工作位置
        private string bol = "0";
        //[CategoryAttribute("Data")]
        //[Description("手车工作位置信号，0为实验位置，1为工作位置,2为断开位置")]
        //public string Bol
        //{
        //    get { return bol; }
        //    set { bol = value; }
        //}
        private string faultSignal = "0";//故障信号
        [CategoryAttribute("Data")]
        [Description("手车故障信号，0为正常状态，1为故障状态")]
        public string FaultSignal
        {
            get { return faultSignal; }
            set { faultSignal = value; }

        }
        private void shouche_Load(object sender, EventArgs e)
        {
            shouche_Resize(sender, e);


        }

        private void shouche_Paint(object sender, PaintEventArgs e)
        {
            Pen a = new Pen(CtrColor, 1);
            e.Graphics.DrawArc(a, x * 0.5f, y * 0.7f, x, y * 0.6f, 180, 180);
            e.Graphics.DrawLine(a, x, 0, x, y * 0.7f);
            e.Graphics.DrawLine(a, x, y, x, y * 2f);

            if (bol == "1")
            {
                SolidBrush b1 = new SolidBrush(Color.Red);
                e.Graphics.FillRectangle(b1, x * 0.82f, y * 1.0f, x * 0.36f, y * 0.4f);
            }
            if (bol == "0")
            {
                SolidBrush b1 = new SolidBrush(Color.FromArgb(255, 0, 255, 0));
                e.Graphics.FillRectangle(b1, x * 0.82f, y * 1.0f, x * 0.36f, y * 0.4f);
            }
            if (bol == "2")
            {
                SolidBrush b1 = new SolidBrush(Color.White);
                e.Graphics.FillRectangle(b1, x * 0.82f, y * 1.0f, x * 0.36f, y * 0.4f);
            }
            Pen c = new Pen(Color.White, 3);
            if (faultSignal == "1")
            {

                e.Graphics.DrawRectangle(c, x * 0.1f, y * 0.1f, x * 1.8f, y * 1.8f);

            }

        }

        private void shouche_Resize(object sender, EventArgs e)
        {
            this.x = this.Width / 2;
            this.y = this.Height / 2;
            //this.Refresh();
        }

        private void Shouche_10k_Up_BolChanged(TongJi_EMS._Event.TJBolChangeArgs e)
        {
            if (e.State != "0" && e.State != "1" && e.State != "2")
                this.bol = "0";
            else
                this.bol = e.State;
            this.Refresh();
        }


    }
}